package com.crazy.crazytransactionservice.controller;

import com.crazy.crazycommon.common.BaseResponse;
import com.crazy.crazycommon.common.ResultUtils;
import com.crazy.crazymodel.model.vo.OrderCancelVO;
import com.crazy.crazytransactionservice.service.CancelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Date: 2024-05-07-14:56
 * @Author: Zheng Zeliang
 * 撤单的controller
 */

@RestController
@RequestMapping("/transaction")
@Api(tags = "撤单相关接口")
@Slf4j
public class CancelController {
    @Resource
    private CancelService cancelService;

    @ApiOperation(value = "撤单")
    @PostMapping("/cancel/{orderId}")
    public BaseResponse<OrderCancelVO> cancel(@PathVariable int orderId){
        OrderCancelVO cancelVO = cancelService.cancel(orderId);
        return ResultUtils.success(cancelVO);
    }
}
